<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var value = parseInt(prompt('请输入三位数字，如156计算结果将会是12'));
        var ge = parseInt(value % 10);
        var shi = parseInt(value % 100 / 10);
        var bai = parseInt(value % 1000 / 100);
        alert(ge + shi + bai);
    </script>
</body>
</html>